// $ANTLR 3.2 Sep 23, 2009 12:02:23 /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g 2010-11-26 01:11:59

import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

import org.antlr.runtime.debug.*;
import java.io.IOException;
public class gramAntlrParser extends DebugParser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "N", "'/'", "'^'", "'_'", "'('", "')'", "'{'", "'}'"
    };
    public static final int T__11=11;
    public static final int N=4;
    public static final int T__10=10;
    public static final int EOF=-1;
    public static final int T__9=9;
    public static final int T__8=8;
    public static final int T__7=7;
    public static final int T__6=6;
    public static final int T__5=5;

    // delegates
    // delegators

    public static final String[] ruleNames = new String[] {
        "invalidRule", "z", "e", "a", "b", "c"
    };
     
        public int ruleLevel = 0;
        public int getRuleLevel() { return ruleLevel; }
        public void incRuleLevel() { ruleLevel++; }
        public void decRuleLevel() { ruleLevel--; }
        public gramAntlrParser(TokenStream input) {
            this(input, DebugEventSocketProxy.DEFAULT_DEBUGGER_PORT, new RecognizerSharedState());
        }
        public gramAntlrParser(TokenStream input, int port, RecognizerSharedState state) {
            super(input, state);
            DebugEventSocketProxy proxy =
                new DebugEventSocketProxy(this, port, null);
            setDebugListener(proxy);
            try {
                proxy.handshake();
            }
            catch (IOException ioe) {
                reportError(ioe);
            }
        }
    public gramAntlrParser(TokenStream input, DebugEventListener dbg) {
        super(input, dbg, new RecognizerSharedState());

    }
    protected boolean evalPredicate(boolean result, String predicate) {
        dbg.semanticPredicate(result, predicate);
        return result;
    }


    public String[] getTokenNames() { return gramAntlrParser.tokenNames; }
    public String getGrammarFileName() { return "/home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g"; }



    // $ANTLR start "z"
    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:3:1: z : e EOF ;
    public final void z() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "z");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(3, 1);

        try {
            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:3:3: ( e EOF )
            dbg.enterAlt(1);

            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:3:5: e EOF
            {
            dbg.location(3,5);
            pushFollow(FOLLOW_e_in_z10);
            e();

            state._fsp--;

            dbg.location(3,7);
            match(input,EOF,FOLLOW_EOF_in_z12); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        dbg.location(3, 10);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "z");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "z"


    // $ANTLR start "e"
    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:5:1: e : a ( '/' a )* ;
    public final void e() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "e");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(5, 1);

        try {
            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:5:2: ( a ( '/' a )* )
            dbg.enterAlt(1);

            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:5:4: a ( '/' a )*
            {
            dbg.location(5,4);
            pushFollow(FOLLOW_a_in_e19);
            a();

            state._fsp--;

            dbg.location(5,6);
            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:5:6: ( '/' a )*
            try { dbg.enterSubRule(1);

            loop1:
            do {
                int alt1=2;
                try { dbg.enterDecision(1);

                int LA1_0 = input.LA(1);

                if ( (LA1_0==5) ) {
                    alt1=1;
                }


                } finally {dbg.exitDecision(1);}

                switch (alt1) {
            	case 1 :
            	    dbg.enterAlt(1);

            	    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:5:7: '/' a
            	    {
            	    dbg.location(5,7);
            	    match(input,5,FOLLOW_5_in_e22); 
            	    dbg.location(5,11);
            	    pushFollow(FOLLOW_a_in_e24);
            	    a();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);
            } finally {dbg.exitSubRule(1);}


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        dbg.location(5, 14);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "e");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "e"


    // $ANTLR start "a"
    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:7:1: a : ( b )+ ;
    public final void a() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "a");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(7, 1);

        try {
            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:7:2: ( ( b )+ )
            dbg.enterAlt(1);

            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:7:4: ( b )+
            {
            dbg.location(7,4);
            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:7:4: ( b )+
            int cnt2=0;
            try { dbg.enterSubRule(2);

            loop2:
            do {
                int alt2=2;
                try { dbg.enterDecision(2);

                int LA2_0 = input.LA(1);

                if ( (LA2_0==N||LA2_0==8||LA2_0==10) ) {
                    alt2=1;
                }


                } finally {dbg.exitDecision(2);}

                switch (alt2) {
            	case 1 :
            	    dbg.enterAlt(1);

            	    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:7:4: b
            	    {
            	    dbg.location(7,4);
            	    pushFollow(FOLLOW_b_in_a33);
            	    b();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt2 >= 1 ) break loop2;
                        EarlyExitException eee =
                            new EarlyExitException(2, input);
                        dbg.recognitionException(eee);

                        throw eee;
                }
                cnt2++;
            } while (true);
            } finally {dbg.exitSubRule(2);}


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        dbg.location(7, 6);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "a");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "a"


    // $ANTLR start "b"
    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:9:1: b : c ( '^' c )? ( '_' c )? ;
    public final void b() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "b");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(9, 1);

        try {
            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:9:2: ( c ( '^' c )? ( '_' c )? )
            dbg.enterAlt(1);

            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:9:4: c ( '^' c )? ( '_' c )?
            {
            dbg.location(9,4);
            pushFollow(FOLLOW_c_in_b41);
            c();

            state._fsp--;

            dbg.location(9,5);
            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:9:5: ( '^' c )?
            int alt3=2;
            try { dbg.enterSubRule(3);
            try { dbg.enterDecision(3);

            int LA3_0 = input.LA(1);

            if ( (LA3_0==6) ) {
                alt3=1;
            }
            } finally {dbg.exitDecision(3);}

            switch (alt3) {
                case 1 :
                    dbg.enterAlt(1);

                    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:9:6: '^' c
                    {
                    dbg.location(9,6);
                    match(input,6,FOLLOW_6_in_b43); 
                    dbg.location(9,9);
                    pushFollow(FOLLOW_c_in_b44);
                    c();

                    state._fsp--;


                    }
                    break;

            }
            } finally {dbg.exitSubRule(3);}

            dbg.location(9,12);
            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:9:12: ( '_' c )?
            int alt4=2;
            try { dbg.enterSubRule(4);
            try { dbg.enterDecision(4);

            int LA4_0 = input.LA(1);

            if ( (LA4_0==7) ) {
                alt4=1;
            }
            } finally {dbg.exitDecision(4);}

            switch (alt4) {
                case 1 :
                    dbg.enterAlt(1);

                    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:9:13: '_' c
                    {
                    dbg.location(9,13);
                    match(input,7,FOLLOW_7_in_b48); 
                    dbg.location(9,16);
                    pushFollow(FOLLOW_c_in_b49);
                    c();

                    state._fsp--;


                    }
                    break;

            }
            } finally {dbg.exitSubRule(4);}


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        dbg.location(9, 19);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "b");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "b"


    // $ANTLR start "c"
    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:11:1: c : ( N | '(' e ')' | '{' e '}' );
    public final void c() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "c");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(11, 1);

        try {
            // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:11:2: ( N | '(' e ')' | '{' e '}' )
            int alt5=3;
            try { dbg.enterDecision(5);

            switch ( input.LA(1) ) {
            case N:
                {
                alt5=1;
                }
                break;
            case 8:
                {
                alt5=2;
                }
                break;
            case 10:
                {
                alt5=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 5, 0, input);

                dbg.recognitionException(nvae);
                throw nvae;
            }

            } finally {dbg.exitDecision(5);}

            switch (alt5) {
                case 1 :
                    dbg.enterAlt(1);

                    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:11:4: N
                    {
                    dbg.location(11,4);
                    match(input,N,FOLLOW_N_in_c58); 

                    }
                    break;
                case 2 :
                    dbg.enterAlt(2);

                    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:11:8: '(' e ')'
                    {
                    dbg.location(11,8);
                    match(input,8,FOLLOW_8_in_c62); 
                    dbg.location(11,11);
                    pushFollow(FOLLOW_e_in_c63);
                    e();

                    state._fsp--;

                    dbg.location(11,12);
                    match(input,9,FOLLOW_9_in_c64); 

                    }
                    break;
                case 3 :
                    dbg.enterAlt(3);

                    // /home/kivi/Fac/tleng/tleng2010/Codigo/gramAntlr.g:11:18: '{' e '}'
                    {
                    dbg.location(11,18);
                    match(input,10,FOLLOW_10_in_c68); 
                    dbg.location(11,22);
                    pushFollow(FOLLOW_e_in_c70);
                    e();

                    state._fsp--;

                    dbg.location(11,24);
                    match(input,11,FOLLOW_11_in_c72); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        dbg.location(11, 27);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "c");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "c"

    // Delegated rules


 

    public static final BitSet FOLLOW_e_in_z10 = new BitSet(new long[]{0x0000000000000000L});
    public static final BitSet FOLLOW_EOF_in_z12 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_a_in_e19 = new BitSet(new long[]{0x0000000000000022L});
    public static final BitSet FOLLOW_5_in_e22 = new BitSet(new long[]{0x0000000000000510L});
    public static final BitSet FOLLOW_a_in_e24 = new BitSet(new long[]{0x0000000000000022L});
    public static final BitSet FOLLOW_b_in_a33 = new BitSet(new long[]{0x0000000000000512L});
    public static final BitSet FOLLOW_c_in_b41 = new BitSet(new long[]{0x00000000000000C2L});
    public static final BitSet FOLLOW_6_in_b43 = new BitSet(new long[]{0x0000000000000510L});
    public static final BitSet FOLLOW_c_in_b44 = new BitSet(new long[]{0x0000000000000082L});
    public static final BitSet FOLLOW_7_in_b48 = new BitSet(new long[]{0x0000000000000510L});
    public static final BitSet FOLLOW_c_in_b49 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_N_in_c58 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_8_in_c62 = new BitSet(new long[]{0x0000000000000510L});
    public static final BitSet FOLLOW_e_in_c63 = new BitSet(new long[]{0x0000000000000200L});
    public static final BitSet FOLLOW_9_in_c64 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_10_in_c68 = new BitSet(new long[]{0x0000000000000510L});
    public static final BitSet FOLLOW_e_in_c70 = new BitSet(new long[]{0x0000000000000800L});
    public static final BitSet FOLLOW_11_in_c72 = new BitSet(new long[]{0x0000000000000002L});

}